#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
	char ch[4];
	
	ch[0] = getchar();
	ch[1] = getchar();
	ch[2] = getchar();
	ch[3] = getchar();
	
	ch[0] = ch[0] - 0x30;
	ch[1] = ch[1] - 0x30;
	ch[2] = ch[2] - 0x30;
	ch[3] = ch[3] - 0x30;
	
	printf("%d", ch[0] + ch[1] + ch[2] + ch[3]);
	
	return 0;
}